using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace Lifter.Gui.Monitor.Controls
{
	public class BaseControl : Control
	{
		protected bool selected = false;
		protected bool errorState = false;
		private IContainer components = null;
		public BaseControl()
		{
			this.InitializeComponent();
			base.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
			base.PerformLayout();
		}
		protected void DrawEclipse(Graphics g, Rectangle rect, Pen drawColor, Brush fillColor)
		{
			g.FillEllipse(fillColor, rect);
			g.DrawEllipse(drawColor, rect);
		}
		protected void DrawRect(Graphics g, Rectangle rect, Brush drawColor, Brush fillColor)
		{
			int num = 1;
			int x = rect.X;
			int y = rect.Y;
			int width = rect.Width;
			int height = rect.Height;
			g.FillRectangle(drawColor, new Rectangle(x + num / 2, y + num / 2, width - num, height - num));
			Pen pen = new Pen(fillColor, (float)num);
			g.DrawRectangle(pen, new Rectangle(x + num / 2, y + num / 2, width - num, height - num));
		}
		protected void DrawRoundRect(Graphics g, Rectangle rect, int radius, Brush drawColor, Brush fillColor, int penWidth)
		{
			int x = rect.X;
			int y = rect.Y;
			int width = rect.Width;
			int height = rect.Height;
			Pen pen = new Pen(fillColor, (float)penWidth);
			g.FillRectangle(drawColor, new Rectangle(x + penWidth / 2, y + penWidth / 2, width - penWidth, height - penWidth));
			GraphicsPath graphicsPath = new GraphicsPath();
			graphicsPath.AddLine(x + radius, y, x + width - radius * 2, y);
			graphicsPath.AddArc(x + width - radius * 2, y, radius * 2, radius * 2, 270f, 90f);
			graphicsPath.AddLine(x + width, y + radius, x + width, y + height - radius * 2);
			graphicsPath.AddArc(x + width - radius * 2, y + height - radius * 2, radius * 2, radius * 2, 0f, 90f);
			graphicsPath.AddLine(x + width - radius * 2, y + height, x + radius, y + height);
			graphicsPath.AddArc(x, y + height - radius * 2, radius * 2, radius * 2, 90f, 90f);
			graphicsPath.AddLine(x, y + height - radius * 2, x, y + radius);
			graphicsPath.AddArc(x, y, radius * 2, radius * 2, 180f, 90f);
			graphicsPath.CloseFigure();
			g.DrawPath(pen, graphicsPath);
			graphicsPath.Dispose();
		}
		protected void DrawRoundRect(Graphics g, RectangleF rect, int radius, Brush drawColor, Brush fillColor, int penWidth)
		{
			float x = rect.X;
			float y = rect.Y;
			float width = rect.Width;
			float height = rect.Height;
			Pen pen = new Pen(fillColor, (float)penWidth);
			g.FillRectangle(drawColor, new RectangleF(x + (float)(penWidth / 2), y + (float)(penWidth / 2), width - (float)penWidth, height - (float)penWidth));
			GraphicsPath graphicsPath = new GraphicsPath();
			graphicsPath.AddLine(x + (float)radius, y, x + width - (float)(radius * 2), y);
			graphicsPath.AddArc(x + width - (float)(radius * 2), y, (float)(radius * 2), (float)(radius * 2), 270f, 90f);
			graphicsPath.AddLine(x + width, y + (float)radius, x + width, y + height - (float)(radius * 2));
			graphicsPath.AddArc(x + width - (float)(radius * 2), y + height - (float)(radius * 2), (float)(radius * 2), (float)(radius * 2), 0f, 90f);
			graphicsPath.AddLine(x + width - (float)(radius * 2), y + height, x + (float)radius, y + height);
			graphicsPath.AddArc(x, y + height - (float)(radius * 2), (float)(radius * 2), (float)(radius * 2), 90f, 90f);
			graphicsPath.AddLine(x, y + height - (float)(radius * 2), x, y + (float)radius);
			graphicsPath.AddArc(x, y, (float)(radius * 2), (float)(radius * 2), 180f, 90f);
			graphicsPath.CloseFigure();
			g.DrawPath(pen, graphicsPath);
			graphicsPath.Dispose();
		}
		protected static GraphicsPath CreateRoundRectangle(Rectangle rectangle, int radius)
		{
			GraphicsPath graphicsPath = new GraphicsPath();
			int left = rectangle.Left;
			int top = rectangle.Top;
			int width = rectangle.Width;
			int height = rectangle.Height;
			int num = radius << 1;
			graphicsPath.AddArc(left, top, num, num, 180f, 90f);
			graphicsPath.AddLine(left + radius, top, left + width - radius, top);
			graphicsPath.AddArc(left + width - num, top, num, num, 270f, 90f);
			graphicsPath.AddLine(left + width, top + radius, left + width, top + height - radius);
			graphicsPath.AddArc(left + width - num, top + height - num, num, num, 0f, 90f);
			graphicsPath.AddLine(left + width - radius, top + height, left + radius, top + height);
			graphicsPath.AddArc(left, top + height - num, num, num, 90f, 90f);
			graphicsPath.AddLine(left, top + height - radius, left, top + radius);
			graphicsPath.CloseFigure();
			return graphicsPath;
		}
		protected static GraphicsPath CreateTopRoundRectangle(Rectangle rectangle, int radius)
		{
			GraphicsPath graphicsPath = new GraphicsPath();
			int left = rectangle.Left;
			int top = rectangle.Top;
			int width = rectangle.Width;
			int height = rectangle.Height;
			int num = radius << 1;
			graphicsPath.AddArc(left, top, num, num, 180f, 90f);
			graphicsPath.AddLine(left + radius, top, left + width - radius, top);
			graphicsPath.AddArc(left + width - num, top, num, num, 270f, 90f);
			graphicsPath.AddLine(left + width, top + radius, left + width, top + height);
			graphicsPath.AddLine(left + width, top + height, left, top + height);
			graphicsPath.AddLine(left, top + height, left, top + radius);
			graphicsPath.CloseFigure();
			return graphicsPath;
		}
		protected static GraphicsPath CreateBottomRadialPath(Rectangle rectangle)
		{
			GraphicsPath graphicsPath = new GraphicsPath();
			RectangleF rect = rectangle;
			rect.X -= rect.Width * 0.35f;
			rect.Y -= rect.Height * 0.15f;
			rect.Width *= 1.7f;
			rect.Height *= 2.3f;
			graphicsPath.AddEllipse(rect);
			graphicsPath.CloseFigure();
			return graphicsPath;
		}
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.components != null)
			{
				this.components.Dispose();
			}
			base.Dispose(disposing);
		}
		private void InitializeComponent()
		{
		}
	}
}
